const changeFavicon = link => {
  let $favicon = document.querySelector('link[rel="icon"]');
  // If a <link rel="icon"> element already exists,
  // change its href to the given link.
  if ($favicon !== null) {
    $favicon.href = link;
    // Otherwise, create a new element and append it to <head>.
  } else {
    $favicon = document.createElement("link");
    $favicon.rel = "icon";
    $favicon.href = link;
    document.head.appendChild($favicon);
  }
};
const Icon =  function() {
        console.log(123123 + process.env.VUE_APP_ENV)
     
      if (process.env.VUE_APP_ENV ==  'development'){
        console.log('bd')
        return './WechatIMG918.png'
        
      }
      if (process.env.VUE_APP_ENV ==  'production'){
        console.log('cs')
        return './WechatIMG918.png'
        
      }
  
      if (process.env.VUE_APP_ENV ==  'staging'){
        console.log('jf')
        return './WechatIMG918.png'
        
      }
      if(process.env.VUE_APP_ENV == 'twnd'){
        console.log('twnd')
        return './WechatIMG925.png'
      }
}
  // let icon =  './WechatIMG918.png' ; // 图片地址
  // let icon = Icon()
const icon = function (){
  changeFavicon(Icon()); // 动态修改网站图标
}
export default icon
  